<%--
  Created by IntelliJ IDEA.
  User: zhaojianxin
  Date: 2019-03-06
  Time: 13:54
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>支付</title>
    <style>
        .box, .bt1 {
            width: 150px;
            margin: 0 auto;
        }
    </style>
    <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>


</head>
<body>
<div class="box">
    <h5>你即将支付: ${money}元</h5>
    <br/>
    <br/>
    <div>
        <button class="bt1" onclick="pay()">确定</button>
    </div>
</div>
</body>
<script>
    var callback = "${callback}";

    function pay() {
        $.ajax({
            type: 'get',
            url: callback,
            dataType: 'json',
            success: function (res) {
                //请求成功
                if ("success" === res) {
                     $(".box").html("<h1>支付成功<h1/>");
                 } else {
                     $(".box").html("<h1>支付失败<h1/>");
                }
            },
            error: function (err) {
                console.log(err)
            }
        });
    }
</script>
</html>
